import { getAction, deleteAction, putAction, postAction, httpAction, postFormData } from '@/api/manage'
const gateway = '/gateway/api'
const jnby = '/jnby-boot'

// 状态
const findExpressType = (params) => postAction(gateway + '/admin/state/findExpressType', params) // 获取物流单据类型
const findBoxSupplyReason = (params) => postAction(gateway + '/admin/state/findBoxSupplyReason', params) // 获取补货原因
const findBoxSupplyStatus = (params) => postAction(gateway + '/admin/state/findBoxSupplyStatus', params) // 获取补货状态

// 新box+后台服务单管理入口
const queryForList = (params) => postAction(gateway + '/admin/orderForSet/queryForList', params) // 后台的服务单列表查询
const queryForMainDetail = (params) => postAction(gateway + '/admin/orderForSet/queryForMainDetail', params) // 后台的box服务单详情主界面查询
const queryForProductDetails = (params) => postAction(gateway + '/admin/orderForSet/queryForProductDetails', params) // box服务单详情查询商品信息
const queryForBoxDetailLog = (params) => postAction(gateway + '/admin/orderForSet/queryForBoxDetailLog', params) // box服务单详情日志
const queryForCustomerDemand = (params) => postAction(gateway + '/admin/orderForSet/queryForCustomerDemand', params) // 服务单详情查询会员需求和搭配方案
const queryBoxEval = (params) => postAction(gateway + '/admin/orderForSet/queryBoxEval', params) // 查看服务单评价
const queryForBoxDiscount = (params) => postAction(gateway + '/admin/orderForSet/queryForBoxDiscount', params) // 商场折扣列表
const setForBoxDiscount = (params) => postAction(gateway + '/admin/orderForSet/setForBoxDiscount', params) // 设置商品折扣
const setNoPayReason = (params) => postAction(gateway + '/admin/orderForSet/setNoPayReason', params) // 未购买原因
const getProductInfo = (params) => postAction(gateway + '/admin/orderForSet/getProductInfo', params) // new后台的box服务单详情查询商品信息
const boxListCount = (params) => postAction(gateway + '/admin/orderForSet/boxListCount', params) // 服务单列表统计
const getBoxByBoxId = (params) => postAction(gateway + '/admin/orderForSet/getBoxByBoxId', params) // 服务单查询
const resetAddCartByBoxId = (params) => postAction(gateway + '/admin/orderForSet/resetAddCartByBoxId', params) //重制


const boxSupplyCount = (params) => postAction(gateway + '/admin/dress/boxSupplyCount', params) // 补货单次数查询
const getBoxReturnList = (params) => postAction(gateway + '/admin/dress/getBoxReturnList', params) // 获取还货单列表
const handleReturnError = (params) => postAction(gateway + '/admin/dress/handleReturnError', params) // 处理还货异常
const noInReturnDetails = (params) => postAction(gateway + '/admin/dress/noInReturnDetails', params) // 获取没有入库商品列表
const getReturnDetails = (params) => postAction(gateway + '/admin/dress/getReturnDetails', params) // 获取还货单详情列表
const boxDetailPriceCondition = (params) => postAction(gateway + '/minapp/order/boxDetailPriceCondition', params) //服务单详情页单品价格加载
const getSupplyLogistics = (params) => postAction(gateway + '/admin/dress/getSupplyLogistics', params) // 补货获取

// 物流信息
const findLogisticGroup = (params) => postAction(gateway + '/admin/logistics/findLogisticGroup', params) // 获取物流分组
const logisticsDetails = (params) => postAction(gateway + '/admin/logistics/logisticsDetails', params) // 物流详细信息查询
const findLogisticsCompany = (params) => postAction(gateway + '/admin/logistics/findLogisticsCompany', params) // 物流公司查询
const returnTime = (params) => postAction(gateway + '/admin/logistics/returnTime', params) // 获取通用退货时间（今天，明天，后天）
const getChangCodeLogisticsDetails = (params) => postAction(gateway + '/admin/logistics/getChangCodeLogisticsDetails', params) // 获取换码物流

// 搭配师后台
const specialSendBox = (params) => postAction(gateway + '/admin/dress/specialSendBox', params) // 测试发货
const specialSignBox = (params) => postAction(gateway + '/admin/dress/specialSignBox', params) // 测试签收
const finishBox = (params) => postAction(gateway + '/admin/dress/finishBox', params) // 测试完成
const getReturnBoxDetails = (params) => postAction(gateway + '/admin/dress/getReturnBoxDetails', params) // 获取还货商品
const returnProduct = (params) => postAction(gateway + '/admin/dress/returnProduct', params) // 服务单预约快递还货
const createReturnOrder = (params) => postAction(gateway + '/admin/dress/createReturnOrder', params) // 创建还货单
const getBoxSupply = (params) => postAction(gateway + '/admin/dress/getBoxSupply', params) // 补货单查询
const boxSupplySave = (params) => postAction(gateway + '/admin/dress/boxSupplySave', params) // 补货
const delBoxDetails = (params) => postAction(gateway + '/admin/dress/delBoxDetails', params) // 商品删款
const getDelBoxDetailsInWait = (params) => postAction(gateway + '/admin/dress/getDelBoxDetailsInWait', params) // 待发货下获取删除商品list
const getSpecialFinishBoxDetails = (params) => postAction(gateway + '/admin/dress/getSpecialFinishBoxDetails', params) // 获取测试完成页面的商品列表
const handSignAndReceive = (params) => postAction(gateway + '/admin/dress/handSignAndReceive', params) // 手动签收
const updateExpressNo = (params) => postAction(gateway + '/admin/dress/updateExpressNo', params) // 修改快递
const updateBoxReturnMemo = (params) => postAction(gateway + '/admin/dress/updateBoxReturnMemo', params) // 修改还货单备注
const syncOms = (params) => postAction(gateway + '/admin/dress/syncOms', params) // OMS同步接口
const getBoxReturnAllInfo = (params) => postAction(gateway + '/admin/dress/getBoxReturnAllInfo', params) // 还货记录
const forceReturnProduct = (params) => postAction(gateway + '/admin/dress/forceReturnProduct', params) // 强制还货
const delBoxReturnDetailById = (params) => postAction(gateway + '/admin/dress/delBoxReturnDetailById', params) // 移除
const cancelExpress = (params) => postAction(gateway + '/admin/dress/cancelExpress', params) // 取消还货
const delBoxDetailAndBoxReturnDetail = (params) => postAction(gateway + '/admin/dress/delBoxDetailAndBoxReturnDetail', params) // 删款
const syncWeChatReturnStatus = (returnDetailId) => postAction(gateway + '/admin/dress/syncTheReturnGoods/' + returnDetailId) // 微商城退货单-同步
const checkUnSignProduct = (boxId) => getAction(`/gateway/api/minapp/order/checkUnSignProduct/${boxId}`) //校验是否包含在途商品

// 销售订单管理
const querySalesOrder = (params) => postAction(gateway + '/admin/salesOrder/querySalesOrder', params) // 查询销售订单列表
const querySalesOrderDetail = (params) => postAction(gateway + '/admin/salesOrder/querySalesOrderDetail', params) // 查询销售订单详情
const queryOrderIdWithBoxDetailsId = (params) => postAction(gateway + '/admin/salesOrder/queryOrderIdWithBoxDetailsId', params) // 根据boxId 获取detailsId与orderId关系

export {
  queryForList,
  findLogisticGroup,
  logisticsDetails,
  findExpressType,
  returnTime,
  specialSendBox,
  specialSignBox,
  finishBox,
  getReturnBoxDetails,
  queryForMainDetail,
  findLogisticsCompany,
  returnProduct,
  createReturnOrder,
  getBoxSupply,
  queryForProductDetails,
  queryForBoxDetailLog,
  boxSupplySave,
  findBoxSupplyReason,
  queryForCustomerDemand,
  delBoxDetails,
  getDelBoxDetailsInWait,
  findBoxSupplyStatus,
  querySalesOrder,
  querySalesOrderDetail,
  queryBoxEval,
  queryForBoxDiscount,
  setForBoxDiscount,
  setNoPayReason,
  getSpecialFinishBoxDetails,
  getProductInfo,
  queryOrderIdWithBoxDetailsId,
  boxListCount,
  getBoxByBoxId,
  getChangCodeLogisticsDetails,
  boxSupplyCount,
  getBoxReturnList,
  handleReturnError,
  noInReturnDetails,
  getReturnDetails,
  boxDetailPriceCondition,
  handSignAndReceive,
  updateExpressNo,
  updateBoxReturnMemo,
  syncOms,
  getBoxReturnAllInfo,
  forceReturnProduct,
  delBoxReturnDetailById,
  cancelExpress,
  delBoxDetailAndBoxReturnDetail,
  resetAddCartByBoxId,
  getSupplyLogistics,
  syncWeChatReturnStatus,
  checkUnSignProduct
}
export const explicitBrandIncome = params => postAction(gateway + '/admin/orderForSet/explicitBrandIncome', params) // 指定结算业绩品牌
export const sendVirtureOms = params => postAction(gateway + '/admin/orderForSet/sendVirtureOms', params) // 虚拟发货

// 结算
export const combineBoxBeforeConfirm = (params) => postAction(gateway + '/corp/shoppingGuide/combineBoxBeforeConfirm', params) // 导购端--确认前组合Box信息
export const chooseProductSettlement = (params) => postAction(gateway + '/minapp/order/chooseProductSettlement', params) //订单结算页面
export const setShopDiscount = (params) => postAction(gateway + '/corp/shoppingGuide/setShopDiscount', params) // 设置商场折扣
export const orderSubmit = (params) => postAction(gateway + '/corp/order/submit', params) // 导购提交订单——生成结算二维码
export const calcBoxPrice = params => postAction(gateway + '/minapp/order/calcBoxPrice', params) // 计算服务单商品价格
export const preferential = (params, type) => getAction('/api/gateway/jnby-calc-center/calc/api/preferential?billno=' + params + '&type=' + type) // 获取促销策略
export const boxJoinShop = (params) => postAction(gateway + '/corp/order/boxJoinShop', params) // 服务单开启/关闭/修改 商场折扣
export const joinShop = (id) => getAction(gateway + `/corp/order/joinShop/${id}`) // 商品开启/关闭 商场折扣
export const getSecurityDiscount = (params) => postAction(gateway + '/corp/order/getSecurityDiscount', params) // 获取门店商品安全折扣